package lerry.display;
import flash.display.DisplayObject;
import flash.display.Stage;
import flash.Lib;

/**
 * ...
 * @author lerry
 */
class StageInfo {
	
	/**
	 * 舞台宽度
	 */
	static public var STAGE_WIDTH(get_STAGE_WIDTH, null):Int;
	/**
	 * 舞台高度
	 */
	static public var STAGE_HEIGHT(get_STAGE_HEIGHT, null):Int;
	/**
	 * 舞台半宽
	 */
	static public var HALF_STAGE_WIDTH(get_HALF_STAGE_WIDTH,null):Float;
	/**
	 * 舞台半高
	 */
	static public var HALF_STAGE_HEIGHT(get_HALF_STAGE_HEIGHT,null):Float;
	
	
	/**
	 * 舞台背景颜色
	 */
	static public var STAGE_COLOR(get_STAGE_COLOR, set_STAGE_COLOR):Int;
	/**
	 * 帧频
	 */
	static public var FRAME_RATE:Float;
	/**
	 * 获取对当前舞台的引用
	 */
	static public var STAGE(get_STAGE,null):Stage;
	
	static private function set_STAGE_COLOR(val:Int):Int{
		STAGE.color = val;
		return STAGE.color;
	}
	static private function get_STAGE_COLOR():Int {
		return STAGE.color;
	}
	static function get_STAGE():Stage {
		return Lib.current.stage;
	}
	static function get_STAGE_WIDTH():Int {
		return Lib.current.stage.stageWidth;
	}
	static function get_STAGE_HEIGHT():Int {
		return Lib.current.stage.stageHeight;
	}
	static function get_FRAME_RATE():Float {
		return Lib.current.stage.frameRate;
	}
	static function set_FRAME_RATE(fram:Float):Float {
		Lib.current.stage.frameRate = fram;
		return fram;
	}
	static private function get_HALF_STAGE_HEIGHT() {
		return STAGE_HEIGHT * .5;
	}
	static private function get_HALF_STAGE_WIDTH():Float {
		return STAGE_WIDTH * .5;
	}
	
	static public function ADD_TO_STAGE(child:DisplayObject):Void {
		STAGE.addChild(child);
	}
}